Skip to content
  • 0 Votes
    7 Posts
    26k Views
    JonBJ

    @Burke212
    Given that you are not using the designer, create your own QWidget *mainWidget and at some point call setCentralWidget(mainWidget). You can add your widgets onto your mainWidget before or after setting it as your central widget, I don't think it matters.

    So just one "main widget", which you create, and then you set the main window to have that as its central widget.

  • 0 Votes
    2 Posts
    1k Views
    SGaistS

    Hi,

    That might be something that have changed between Qt versions. You should go to the bug report system and see if there's already something about it. If not please consider opening a bug for the documentation to be updated on that aspect.

  • 1 Votes
    3 Posts
    2k Views
    J

    @Jakob
    Thanks, Mr. Jakob. I'd tried to resize central widget in resizeEvent(), I found it seemed that setting the geometry of the central widget's layout could work, but not worked good completely. One of the problems is : the docked widgets's width do not change synchronously, this problem cause spacing or overlapping appeares between central widget and docking widgets while resizing mainwindow.

    I thought maybe I should call 'updateGeometry' for every docked widget, but I have not enough time to verify this guess. would you please tell me?

    Well, there is another question about dockwidget and mainwindow:
    I found there was an internal splitter between central widget and docking widgets, and if I pressed mouse left button and pulled it to another position, the docking widgets's width would be fixed and could only be changed by pulling the splitter. This problem makes my purpose to unreached too. How can I work around it?